// pages/consDetail/consDetail.js
var that
Page({

  /**
   * 页面的初始数据
   */
  data: {
    petMessage:[],
    ID:'',
    doctor:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   that=this
   that.setData({
     ID:options.id
   })
   wx.request({
     url: getApp().globalData.urls + '/wxgz/advisory/getAdvisoryById',
     data: {
       token: wx.getStorageSync("token"),
       id:that.data.ID
     },
     method: "post",
     header: {
       'content-type': 'application/x-www-form-urlencoded'
     },
     success: function (res) {
      let list = that.data.petMessage
      list.push({
        petName: res.data.data.petName,
        Age:res.data.data.petAge,
        sex: res.data.data.petGender==1?'公':'母',
        content:res.data.data.content
      }) 
      that.setData({
        petMessage: list
      })
      
     }
   })

   wx.request({
     url: getApp().globalData.urls + '/wxgz/advisory/getAdvisoryReplyById',
     data: {
       token: wx.getStorageSync("token"),
       id: that.data.ID
     },
     method: "post",
     header: {
       'content-type': 'application/x-www-form-urlencoded'
     },
     success: function (res) {
       if(res.code==200){
         if(res.data){
           that.setData({
             doctor: res.data.data.replyDoctorContent
           })
         }
       } 
     }
   })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})